<template>
  <el-select v-model="value" placeholder="请选择频道" @change="onChange">
    <el-option v-for="item in channels" :key="item.id" :label="item.name" :value="item.id"></el-option>
  </el-select>
</template>

<script>
import { getArticleChannels } from '@/api/articles.js'
export default {
  name: 'channel',
  props: ['value'],
  data () {
    return {
      channels: ''
    }
  },
  created () {
    getArticleChannels().then(res => {
      this.channels = res.data.data.channels
    })
  },
  methods: {
    onChange () {
      this.$emit('input', this.value)
    }
  }
}
</script>

<style>

</style>
